home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1992-09-19 | 1.6 KB | 65 lines |
- DEFINITION MODULE Lists;
-
- (* (C) Copyright 1992 Fitted Software Tools. All rights reserved. *)
-
- (*
- This module defines the LinkedList class.
-
- The LikedList class provides methods to add (append) and delete
- (delete) items from a linked list object and a means of
- traversing that list (getfirst, getnext).
-
- Objects to be placed into the LinkedList must be of type
- LinkedListItem.
- *)
-
-
- CLASS LinkedListItem;
- (*
- We hide the structure of a LinkedListItem in the implementation,
- as the user has no need to access that information.
- *)
- END LinkedListItem;
-
-
- CLASS LinkedList;
- (*
- This class defines methods to add, delete and access items in a
- linked list.
- *)
-
- PROCEDURE append( item :LinkedListItem );
- (*
- Append item to the list.
- *)
-
- PROCEDURE getfirst( VAR item :LinkedListItem ) :BOOLEAN;
- (*
- Get the first item in the list (returned in 'item').
- Return TRUE if there is an item in the list
- FALSE if the list is empty.
- *)
-
- PROCEDURE getnext( VAR item :LinkedListItem ) :BOOLEAN;
- (*
- Get the next item in the list -- You must call getfirst
- before your first call to getnext.
- Return TRUE if a 'next' was returned
- FALSE if we reached the end of the list.
- *)
-
- PROCEDURE delete( item :LinkedListItem );
- (*
- delete item from the list.
- *)
-
- (*
- DESTROY:
- When the list is DISPOSEd, all the items in the list are
- DISPOSEd too.
- *)
-
- END LinkedList;
-
-
- END Lists.